<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Introduction</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-5">
<link rel="stylesheet" type="text/css" href="style.css" />

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.js"></script>
	<script type="text/javascript" src="http://www.google.com/jsapi"></script>
	<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/fonts/fonts-min.css" />
	<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/calendar/assets/skins/sam/calendar.css" />
	<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
	<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/calendar/calendar-min.js"></script>
	
	<script src="http://yui.yahooapis.com/2.2.2/build/yahoo/yahoo-min.js" type="text/javascript"></script> 
	<script src="http://yui.yahooapis.com/2.2.2/build/connection/connection-min.js" type="text/javascript"></script>
</head>
<body onload="rssfeedsetup()">
	<div id="header">
			<ul id="menu">
			<li><a href="index2.php">Introduction</a></li>																																												
			<li><a href="index.php?mypage=hotel">Hotels</a></li>
			<li><a href="index.php?mypage=center">Centers</a></li>
			<li><a href="index.php?mypage=res">Restaurants</a></li>
			<li class="feed" title="ajaxfeed"><a href="Feed.php">Google Feeds</a></li>
			<li><a href="AboutUS.php">About Us</a></li>
			</ul>
	</div>
	<div id="wrapper">
		<div id="left">
		<div>
				<a onclick="original();">Switch to English</a>
				<select onchange="translate(this.options[this.selectedIndex].value);">
				<option value="de">deutsch</option>
				<option value="pt">português</option>
				<option value="fr">français</option>
				<option value="ja">日本語</option>
				<option value="it">italiano</option>
				<option value="ru">pусский</option>
				<option value="zh-CN">中文</option>
				<option value="es">español</option>
				<option value="ko">한국어</option>
				<option value="nl">nederlands</option>
				<option value="hi">हिन्दी </option>
				<option value="el">Ελληνική</option>
				<option value="ro">română</option>
				<option value="vi">Vietnam</option>
				</select>
		</div>
		<div></div>
			<div id="left_navigation">
				<img src="images/gtop.gif" alt="" width="191" height="8" />
				<div class="title1">Popular Tours</div>
				<ul class="contries">
					<li><a href="#">Ho Chi Minh</a></li>
					<li><a href="#">Da Lat</a></li>
					<li><a href="#">Can Tho</a></li>
					<li><a href="#">Ben Tre</a></li>
					<li><a href="#">Vinh Long</a></li>
					<li><a href="#">Ha Tien</a> <span class="new">- NEW</span></li>
					<li><a href="#">Soc Trang</a></li>
					<li><a href="#">Phu Quoc</a> <span class="new">- NEW</span></li>
					<li><a href="#">Ca Mau</a></li>
				</ul>
				<a href="#" class="more">more tours</a>
				<img src="images/gbot.gif" alt="" width="191" height="8" />
			</div>
			<a  class="banner"><img src="media/banner.jpg" alt="" width="191" height="346" /></a>	
		</div>  
		<div id="big">
			<div id="myfeed">
			</div>
			
		</div>
	</div>
	
<script>
/***********************************
Jquery 
************************************/
$("h1").css("color", "#036");
	
$(".open").click(function () {
	$(this).toggleClass('hide');
	if ($(this).next().css('display') == "none")
		$(this).next().show();
	else
		$(this).next().hide();
});


$(".menu").click(function() {

	var page = $(this).attr("title");

	$.get(page+'.html', function(new_page) { $('#content').html(new_page);});

});

$(".feed").click(function() {
	rssfeedsetup();
});

/********************************************
Google Feed API 
*********************************************/
google.load("feeds", "1") //Google Ajax Feed API (ver 1)
//var thefeeds=result.feed.entries
		
function rssfeedsetup(){
	var feedurl="http://rss.cnn.com/rss/edition.rss"
	var feedpointer=new google.feeds.Feed(feedurl) 
	var feedlimit=15
	feedpointer.setNumEntries(feedlimit) 
	feedpointer.load(displayfeed) 
}

function displayfeed(result){
	if (!result.error){
		var thefeeds=result.feed.entries
		var rssoutput="<h3>Latest CNN News:</h3><br /><ul>"
		for (var i=0; i<thefeeds.length; i++)
			rssoutput+="<li><a href='" + thefeeds[i].link + "'>" + thefeeds[i].title + "</a></li>"
		rssoutput+="</ul>"
		var feedcontainer=document.getElementById("myfeed")
		feedcontainer.innerHTML=rssoutput
	} else
		alert("Error!")
}

/********************************************
Google Translate API
*********************************************/
google.load("language", "1");

function translate(lang) { 
   var source = document.getElementById("article").innerHTML;
   var len = source.length;

   // accepts 500 characters per request 
   var words = 500;
	document.getElementById("translation").style.display='block';

	document.getElementById("translation").innerHTML = "";
	
   for(i=0; i<=(len/words); i++) {
     google.language.translate (source.substr(i*words, words),
                 "en", lang, function (result) {
     	if (!result.error) {
     		document.getElementById("translation").innerHTML += result.translation;
    	} }); }  

  // hide text in original language
	document.getElementById("article").style.display = 'none';
  	return false;
}

// switch to original language
function original() {
  document.getElementById("translation").style.display='none';
  document.getElementById("article").style.display = 'block';
  return false;
}

/*************************************
Yahoo calendar
**************************************/
YAHOO.namespace("example.calendar");

YAHOO.example.calendar.init = function() {
 	function handleSelect(type,args,obj) {
	var dates = args[0]; 
	var date = dates[0];
	var year = date[0], month = date[1], day = date[2];
	
	var selMonth = document.getElementById("selMonth");
	var selDay = document.getElementById("selDay");
	var selYear = document.getElementById("selYear");
	
	selMonth.selectedIndex = month;
	selDay.selectedIndex = day;
	
	for (var y=0;y<selYear.options.length;y++) {
	    if (selYear.options[y].text == year) {
	        selYear.selectedIndex = y;
	        break;
	    }
	}
}

function updateCal() {
   var selMonth = document.getElementById("selMonth");
   var selDay = document.getElementById("selDay");
   var selYear = document.getElementById("selYear");
   
   var month = parseInt(selMonth.options[selMonth.selectedIndex].text);
   var day = parseInt(selDay.options[selDay.selectedIndex].value);
   var year = parseInt(selYear.options[selYear.selectedIndex].value);
   
   if (! isNaN(month) && ! isNaN(day) && ! isNaN(year)) {
       var date = month + "/" + day + "/" + year;

       YAHOO.example.calendar.cal1.select(date);
       YAHOO.example.calendar.cal1.cfg.setProperty("pagedate", month + "/" + year);
       YAHOO.example.calendar.cal1.render();
   }
}

YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("cal1","cal1Container", 
        { mindate:"1/1/2009", maxdate:"12/31/2012" });
	YAHOO.example.calendar.cal1.selectEvent.subscribe(handleSelect, YAHOO.example.calendar.cal1, true);
	YAHOO.example.calendar.cal1.render();

   YAHOO.util.Event.addListener(["selMonth","selDay","selYear"], "change", updateCal);
}

/*************************************
Yahoo replace content 
**************************************/
function callAJAX(){
	var url = "lab10.html";
	var callback = { 
		success: function(o) {
				document.getElementById('mydiv').innerHTML =  o.responseText;
				}, 
		failure: function(o) {
				alert("AJAX doesn't work"); //FAILURE
				}
	} 
	
	var transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
	return false;
}

</script>

	<div id="footer">
		<div>
			<a href="index2.php">Home Page</a>   |   <a href="index.php?mypage=hotel">Hotels</a>   |   <a href="index.php?mypage=center">Centers</a>   |    <a href="index.php?mypage=res">Restaurants</a>   |   																																																																																																																																																	<div class="inner_copy"><a href="http://www.beautifullife.info/">beautiful</a><a href="http://www.grungemagazine.com/">grunge</a></div>
		</div>
		<p id="copy">Copyright &copy;. All rights reserved. Design by <a href="http://www.nhattan.info" target="_blank" title="Hoang Nhat Tan">Nhat Tan</a>     </p>
	</div>
</body>
</html>
